
import { ref, onMounted } from "vue";

export default function useCount(getData: Function) {
    const currentPage = ref(1)
    const total = ref(0)
    const pageSize = ref(5)
    const small = ref(true)
    const disabled = ref(false)
    const background = ref(false)

    // 页数发送了改变，再请求渲染
    function currentPageChange(value: number) {
        currentPage.value = value
        getData()
    }

    // 每一页条数发生了改变
    function sizeChange(value: number) {
        getData()
    }

    return {
        currentPage,
        total,
        pageSize,
        small,
        disabled,
        background,
        currentPageChange,
        sizeChange
    }

}